#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableShipModelDao:DaoBase<TableShipModel>
    {
        public override string GetFileName()
        {
            return "TableShipModel.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableShipModel>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TableShipModel model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.id)) UnityEngine.Debug.LogError("数据表id重复:TableShipModel->id: " + model.id);
            #endif
            cachePrimaryInt[model.id] = model;
        }
        protected override TableShipModel ParseRowData(string[] rowData)
        {
            TableShipModel data = new TableShipModel();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.id = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.ModelId = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.UFModelScale = float.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.UFModelOffset = ParseData<float>(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.Radius = float.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.ShipFactoryOffset = rowData[5];
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.ShipFactoryEuler = float.Parse(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.ShipFactoryScale = float.Parse(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.ShipBuildCompleteAniName = string.Intern(rowData[8]);
            }
            if (!string.IsNullOrEmpty(rowData[9]))
            {
                data.ShipBuildCompleteOffset = string.Intern(rowData[9]);
            }
            if (!string.IsNullOrEmpty(rowData[10]))
            {
                data.ShipBuildCompleteScale = float.Parse(rowData[10]);
            }
            if (!string.IsNullOrEmpty(rowData[11]))
            {
                data.WharfOffset = string.Intern(rowData[11]);
            }
            if (!string.IsNullOrEmpty(rowData[12]))
            {
                data.WharfEuler = float.Parse(rowData[12]);
            }
            if (!string.IsNullOrEmpty(rowData[13]))
            {
                data.WharfScale = float.Parse(rowData[13]);
            }
            if (!string.IsNullOrEmpty(rowData[14]))
            {
                data.ShipTradeOffset = string.Intern(rowData[14]);
            }
            if (!string.IsNullOrEmpty(rowData[15]))
            {
                data.ShipTradeEuler = float.Parse(rowData[15]);
            }
            if (!string.IsNullOrEmpty(rowData[16]))
            {
                data.ShipTradeScale = float.Parse(rowData[16]);
            }
            if (!string.IsNullOrEmpty(rowData[17]))
            {
                data.AcShipScale = float.Parse(rowData[17]);
            }
            if (!string.IsNullOrEmpty(rowData[18]))
            {
                data.AcRightPosOffset = rowData[18];
            }
            if (!string.IsNullOrEmpty(rowData[19]))
            {
                data.ACLeftPosOffset = rowData[19];
            }
            if (!string.IsNullOrEmpty(rowData[20]))
            {
                data.hitPosOffset = rowData[20];
            }
            if (!string.IsNullOrEmpty(rowData[21]))
            {
                data.rightFirePosOffset = rowData[21];
            }
            if (!string.IsNullOrEmpty(rowData[22]))
            {
                data.leftFirePosOffset = rowData[22];
            }
            if (!string.IsNullOrEmpty(rowData[23]))
            {
                data.STModelScale = float.Parse(rowData[23]);
            }
            return data;
        }
    }
}
